package com.easybbs.controller;

import com.easybbs.controller.base.BaseController;
import com.easybbs.entity.po.MedicinePO;
import com.easybbs.entity.vo.ResponseVO;
import com.easybbs.entity.vo.web.ClassItemVO;
import com.easybbs.service.impl.LibraryService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/library")
public class LibraryController  extends BaseController {

    @Resource
    LibraryService libraryService;

    @GetMapping("/getSideBar")
    public ResponseVO<List<ClassItemVO>> getSideBar(){
        List<ClassItemVO> sidebar = libraryService.getSidebar();
        return getSuccessResponseVO(sidebar);
    }


    @GetMapping("/getClassItemInfo")
    public ResponseVO<List<MedicinePO>> getClassItemInfo(@RequestParam String itemName){
        List<MedicinePO>  sidebar = libraryService.getClassItemInfo(itemName);
        return getSuccessResponseVO(sidebar);
    }
}
